Run Script
The Run Script command runs a specified script or script file. It is the only command provided by the Run Script scripting addition.SYNTAX
run script referenceOrString ¬ [ with parameters listOfParameters ] ¬ [ in scriptingComponent ]PARAMETERS
- referenceOrString
- A reference of the form
file
nameString oralias nameString
that specifies a script file, or a string that consists of a valid script.
Class: Reference or string
- listOfParameters
- A list of parameters to be passed to the Run handler of the target.
Class: List
- scriptingComponent
- The name of the scripting component to use when running
the script.
Class: StringRESULT
Value returned by script that is run.EXAMPLES
This example runs the scriptbeep
3
, causing the alert sound to sound
three times.
run script "beep 3"This example ensures that the script beep 3 is run by the AppleScript scripting component.
run script "beep 3" in "AppleScript"This example runs Run handler in the script file called MyScript.
run script file "MyVolume:MyDirectory:MyScript"NOTES
To specify the name (nameString) of a script file, use a string of the form"Disk:Folder1:Folder2:...:Filename"
as described in Chapter 5, "Objects
and References," of the AppleScript Language Guide. If you specify only the name of the file (Filename) instead of its entire pathname, AppleScript
attempts to find the file in the current directory.ERRORS